package com.itheima.controller;

import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 统计员工性别信息
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getGenderData(){
        log.info("获取员工性别数据");
        List<Map> genderList  = reportService.getEmpGenderData();
        return Result.success(genderList);

    }

    /**
     * 统计各个职位的员工人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result getJobData(){
        log.info("获取员工职位数据");
     JobOption jobOption = reportService.getEmpJobData();
     return Result.success(jobOption);
    }


    /**
     * 统计学员的学历信息
     * @return
     */
    @GetMapping("/studentDegreeData")
    public  Result getstudentDegreeData(){
       List<Map> genderList =reportService.getstudentDegreeData();
       return Result.success(genderList);

    }





    /**
     * 统计每一个班级的人数
     * @return
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        ClazzOption clazzOption= reportService.getCLazz();
         return Result.success(clazzOption);
    }

}
